<div class="box">
    <div class="heading">
        <h1><img alt="" src="<?php echo base_url('assets/admin/images/review.png'); ?>">Member Details</h1>

        <div class="buttons">
            <a class="button" href="#" id="save" onClick="$('#alan_add_form').submit()"><span>Save</span></a>
        </div>
    </div>
    <div class="content">
        <?php echo form_open_multipart(null, 'id="alan_add_form"'); ?>
		<div class="tabs">
			<ul class="htabs">
				<li><a href="#basic-tab">Basic</a></li>
				<li><a href="#contact-tab">Contact</a></li>
				<li><a href="#social-tab">Social</a></li>
				<li><a href="#life-tab">Life Style</a></li>
				<li><a href="#professional-tab">Professional</a></li>
				<li><a href="#background-tab">Background</a></li>
				<li><a href="#yourself-tab">Describe Yourself</a></li>
				<li><a href="#trip-tab">About Trip</a></li>
				<li><a href="#photo-tab">Add More Photo</a></li>
				<!--<li><a href="#account-tab">Account</a></li>-->
			</ul>
   

			<div id="basic-tab">
				<div class="htabs">
					<a> <h1 class="span1">Basic Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> First Name:', 'firstname'); ?>
						<input name="firstname" type="text" class="txt-box3" id="firstname" value="<?=$firstname?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Last Name:', 'lastname'); ?>
						<input name="lastname" type="text" class="txt-box3" id="lastname" value="<?=$lastname?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Gender:', 'gender'); ?>
						
						<select id="gender" class="txt-box4" name="gender">
							                  
							<option value="male" <?php if($gender=="male") echo "selected='selected'";?> >Male</option>
							<option value="female" <?php if($gender=="female") echo "selected='selected'";?>>Female</option>
						</select>
						
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Date Of Birth:', 'dob'); ?>
						<input name="dob" type="text" class="txt-box3 datepicker" id="dob" value="<?=date("m/d/Y",strtotime($dob))?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Referred By:', 'dob'); ?>
						<select name="refered_by" class="txt-box4" id="refered_by">
							<?php foreach ($referred as $refer) { ?>
								<?php if ($refer['name'] == $refered_by) { ?>
								  <option value="<?php echo $refer['name']; ?>" selected="selected"><?php echo $refer['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $refer['name']; ?>" ><?php echo $refer['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Height:', 'height'); ?>
						<select name="height" class="txt-box4" id="height">
							<?php foreach ($allheight as $height) { ?>
								<?php if ($height['name'] == $height) { ?>
								  <option value="<?php echo $height['name']; ?>" selected="selected"><?php echo $height['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $height['name']; ?>" ><?php echo $height['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Skin Type:', 'skin_type'); ?>
						<select name="skin_type" class="txt-box4" id="skin_type">
							<?php foreach ($allskin as $skin) { ?>
								<?php if ($skin['name'] == $skin_type) { ?>
								  <option value="<?php echo $skin['name']; ?>" selected="selected"><?php echo $skin['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $skin['name']; ?>" ><?php echo $skin['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Body Type:', 'body_type'); ?>
						<select name="body_type" class="txt-box4" id="body_type">
							<?php foreach ($allbodytype as $body) { ?>
								<?php if ($body['name'] == $body_type) { ?>
								  <option value="<?php echo $body['name']; ?>" selected="selected"><?php echo $body['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $body['name']; ?>" ><?php echo $body['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Eye Color:', 'eye_color'); ?>
						<select name="eye_color" class="txt-box4" id="eye_color">
							<?php foreach ($alleyecolor as $eye) { ?>
								<?php if ($eye['name'] == $eye_color) { ?>
								  <option value="<?php echo $eye['name']; ?>" selected="selected"><?php echo $eye['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $eye['name']; ?>" ><?php echo $eye['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
				</div>
			</div>
			<div id="contact-tab">
				<div class="htabs">
					<a> <h1 class="span1">Contact Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> Photo', 'photo'); ?>
						<div class="attorneyimage">
							<img src="<?php echo $thumb;?>" alt="" id="thumb" style="height:100px;width:100px;"/><br />
							<input type="hidden" name="photo" value="<?=$photo?>" id="photo" />
							<a onclick="openKCFinder('photo','thumb')">Browse</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$('#thumb').attr('src', ''); $('#logo').attr('value', '');">Clear</a>
						</div>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Address:', 'address'); ?>
						<textarea id="address" name="address"><?=$address?></textarea>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Country:', 'country'); ?>
						<select name="country_id" class="txt-box4" id="country_id">
							<?php foreach ($countries as $country) { ?>
								<?php if ($country['country_id'] == $country_id) { ?>
								  <option value="<?php echo $country['country_id']; ?>" countryname="<?php echo $country['name']; ?>" selected="selected"><?php echo $country['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $country['country_id']; ?>" countryname="<?php echo $country['name']; ?>" ><?php echo $country['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
						<input type="hidden" id="country" value="" name="country">				
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> State:', 'state'); ?>
						<select name="state_id" class="txt-box4" id="state_id">
							
						</select>
						<input type="hidden" id="state" value="" name="state">
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> City:', 'city'); ?>
						<input name="city" type="text" class="txt-box3" id="city" value="<?=$city?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Zip:', 'zip'); ?>
						<input name="zip" type="text" class="txt-box3" id="zip" value="<?=$zip?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Phone no:', 'phoneno'); ?>
						<input name="phoneno" type="text" class="txt-box3" id="phoneno" value="<?=$phoneno?>"/>
					</div>
				</div>
			</div>
			<div id="social-tab">
				<div class="htabs">
					<a> <h1 class="span1">Social Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Marital Status:', 'marital_status'); ?>
						<select name="marital_status" class="txt-box4" id="marital_status">
							<?php foreach ($maritalstatus as $status) { ?>
								<?php if ($status['name'] == $marital_status) { ?>
								  <option value="<?php echo $status['name']; ?>" selected="selected"><?php echo $status['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $status['name']; ?>" ><?php echo $status['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Mother Tongue:', 'mother_tongue'); ?>
						<select name="mother_tongue" class="txt-box4" id="mother_tongue">
							<?php foreach ($mothertongue as $tongue) { ?>
								<?php if ($tongue['name'] == $mother_tongue) { ?>
								  <option value="<?php echo $tongue['name']; ?>" selected="selected"><?php echo $tongue['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $tongue['name']; ?>" ><?php echo $tongue['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Ethnicity:', 'ethnicity'); ?>
						<select name="ethnicity" class="txt-box4" id="ethnicity">
							<?php foreach ($allethnicity as $ethnicity) { ?>
								<?php if ($ethnicity['name'] == $alanethnicity) { ?>
								  <option value="<?php echo $ethnicity['name']; ?>" selected="selected"><?php echo $ethnicity['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $ethnicity['name']; ?>" ><?php echo $ethnicity['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Relationship:', 'relationship'); ?>
						<select name="relationship" class="txt-box4" id="relationship">
							<?php foreach ($allrelationship as $relationship) { ?>
								<?php if ($relationship['name'] == $alanrelationship) { ?>
								  <option value="<?php echo $relationship['name']; ?>" selected="selected"><?php echo $relationship['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $relationship['name']; ?>" ><?php echo $relationship['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Religion:', 'religion'); ?>
						<select name="religion" class="txt-box4" id="religion">
							<?php foreach ($allreligion as $religion) { ?>
								<?php if ($religion['name'] == $alanreligion) { ?>
								  <option value="<?php echo $religion['name']; ?>" selected="selected"><?php echo $religion['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $religion['name']; ?>" ><?php echo $religion['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					
				</div>
			</div>
			<div id="life-tab">
				<div class="htabs">
					<a> <h1 class="span1">Life Style Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Diet:', 'diet'); ?>
						<select name="diet" class="txt-box4" id="diet">
							<?php foreach ($alldiet as $diet) { ?>
								<?php if ($diet['name'] == $alandiet) { ?>
								  <option value="<?php echo $diet['name']; ?>" selected="selected"><?php echo $diet['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $diet['name']; ?>" ><?php echo $diet['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Drink:', 'drink'); ?>
						<select name="drink" class="txt-box4" id="drink">
							<?php foreach ($alldrink as $drink) { ?>
								<?php if ($drink['name'] == $alandrink) { ?>
								  <option value="<?php echo $drink['name']; ?>" selected="selected"><?php echo $drink['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $drink['name']; ?>" ><?php echo $drink['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Smoke:', 'smoke'); ?>
						<select name="smoke" class="txt-box4" id="smoke">
							<?php foreach ($allsmoke as $smoke) { ?>
								<?php if ($smoke['name'] == $alansmoke) { ?>
								  <option value="<?php echo $smoke['name']; ?>" selected="selected"><?php echo $smoke['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $smoke['name']; ?>" ><?php echo $smoke['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
				</div>
			</div>
			<div id="professional-tab">
				<div class="htabs">
					<a> <h1 class="span1">Professional Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Education Level:', 'education_level'); ?>
						<select name="education_level" class="txt-box4" id="education_level">
							<?php foreach ($educationlevel as $level) { ?>
								<?php if ($level['name'] == $education_level) { ?>
								  <option value="<?php echo $level['name']; ?>" selected="selected"><?php echo $level['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $level['name']; ?>" ><?php echo $level['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Education Field:', 'education_field'); ?>
						<select name="education_field" class="txt-box4" id="education_field">
							<?php foreach ($educationfield as $field) { ?>
								<?php if ($field['name'] == $education_field) { ?>
								  <option value="<?php echo $field['name']; ?>" selected="selected"><?php echo $field['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $field['name']; ?>" ><?php echo $field['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Working With:', 'working_with'); ?>
						<select name="working_with" class="txt-box4" id="working_with">
							<?php foreach ($workingwith as $working) { ?>
								<?php if ($working['name'] == $working_with) { ?>
								  <option value="<?php echo $working['name']; ?>" selected="selected"><?php echo $working['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $working['name']; ?>" ><?php echo $working['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Working As:', 'working_as'); ?>
						<select name="working_as" class="txt-box4" id="working_as">
							<?php foreach ($workingas as $working) { ?>
								<?php if ($working['name'] == $working_as) { ?>
								  <option value="<?php echo $working['name']; ?>" selected="selected"><?php echo $working['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $working['name']; ?>" ><?php echo $working['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
				</div>
			</div>
			<div id="background-tab">
				<div class="htabs">
					<a> <h1 class="span1">Background Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Community :', 'community'); ?>
						<select name="community" class="txt-box4" id="community">
							<?php foreach ($allcommunity as $community) { ?>
								<?php if ($community['name'] == $alancommunity) { ?>
								  <option value="<?php echo $community['name']; ?>" selected="selected"><?php echo $community['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $community['name']; ?>" ><?php echo $community['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> Sub Community', 'sub_community'); ?>
						<input name="sub_community" type="text" class="txt-box3" id="sub_community" value="<?=$sub_community?>"/>
						
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Annual Income:', 'annual_income'); ?>
						<select name="annual_income" class="txt-box4" id="annual_income">
							<?php foreach ($annualincome as $income) { ?>
								<?php if ($income['name'] == $annual_income) { ?>
								  <option value="<?php echo $income['name']; ?>" selected="selected"><?php echo $income['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $income['name']; ?>" ><?php echo $income['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					
				</div>
			</div>
			<div id="yourself-tab">
				<div class="htabs">
					<a> <h1 class="span1">Describe Yourself</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> In Your Own words', 'about_yourself'); ?>
						<textarea id="about_yourself" name="about_yourself"><?=$about_yourself?></textarea>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Any Disability:', 'disability'); ?>
						<select id="disability" class="txt-box4" name="disability">                 
							<option value="None" <?php if($disability=="None") echo "selected='selected'";?> >None</option>
							<option value="Physical Disability" <?php if($disability=="Physical Disability") echo "selected='selected'";?>>Physical Disability</option>
						</select>
					</div>
					
				</div>
			</div>
			<div id="trip-tab">
				<div class="htabs">
					<a> <h1 class="span1">About Trip Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> Place Want To Visit', 'place_visit'); ?>
						<input name="place_visit" type="text" class="txt-box3" id="place_visit" value="<?=$place_visit?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> Interested In', 'interested_in'); ?>
						<?php foreach ($allinterested as $interestedin) { ?>
							<input type="checkbox" name="interested_in[]" value="<?php echo $interestedin['name']; ?>" <?=(in_array($interestedin['name'], $interested_in)) ? 'checked' : '' ?>> <?php echo $interestedin['name']; ?>
						<?php } ?>
												
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Looking To Meet:', 'looking_meet'); ?>
						<select name="looking_meet" class="txt-box4" id="looking_meet">
							<?php foreach ($lookingmeet as $meet) { ?>
								<?php if ($meet['name'] == $looking_meet) { ?>
								  <option value="<?php echo $meet['name']; ?>" selected="selected"><?php echo $meet['name']; ?></option>
								  <?php } else { ?>
								  <option value="<?php echo $meet['name']; ?>" ><?php echo $meet['name']; ?></option>
								 <?php } ?>
							<?php } ?>
						</select>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> About My Travel Partner', 'about_travelpartner'); ?>
						<textarea id="about_travelpartner" name="about_travelpartner"><?=$about_travelpartner?></textarea>
					</div>
				</div>
			</div>
			<div id="photo-tab">
				<div class="htabs">
					<a> <h1 class="span1">Add More Photo</h1></a>
				</div>
				<div class="form">
					<table id="images" class="list">
						<thead>
						  <tr>
							<td class="left">Images</td>
							<td></td>
						  </tr>
						</thead>
						<?php $image_row = 0; ?>
						<?php foreach ($additional_photo as $photo) { ?>
						<tbody id="image-row<?php echo $image_row; ?>">
						  <tr>
							<td class="left"><div class="image"><img src="<?php echo base_url('assets/uploads/images/alan').'/'.$photo['photo']; ?>" alt="" id="thumb<?php echo $image_row; ?>" style="height:100px;width:100px;"/>
								<input type="hidden" name="additional_photo[<?php echo $image_row; ?>]" value="<?php echo $photo['photo']; ?>" id="additional_photo<?php echo $image_row; ?>" />
								<br />
								<a onclick="openKCFinder('additional_photo<?php echo $image_row; ?>', 'thumb<?php echo $image_row; ?>');">Browse</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$('#thumb<?php echo $image_row; ?>').attr('src', ''); $('#image<?php echo $image_row; ?>').attr('value', '');">Clear</a></div></td>
							<td class="left"><a onclick="$('#image-row<?php echo $image_row; ?>').remove();" class="button">Remove</a></td>
						  </tr>
						</tbody>
						<?php $image_row++; ?>
						<?php } ?>
						<tfoot>
						  <tr>
							<td></td>
							<td class="left"><a onclick="addImage();" class="button">Add Images</a></td>
						  </tr>
						</tfoot>
					</table>
				</div>
			</div>
			<!--<div id="account-tab">
				<div class="htabs">
					<a> <h1 class="span1">Account Details</h1></a>
				</div>
				<div class="form">
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> Email', 'email'); ?>
						<input name="email" type="text" class="txt-box3" id="email" value="<?=$email?>"/>
						
					</div>
					
					<div class="field_spacing">
						<?php echo form_label('<div class="arrow arrow_expand"></div><span class="required">*</span> Password', 'password'); ?>
						<input name="show_password" type="text" class="txt-box3" id="show_password" value="<?=$show_password?>"/>
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Account Type:', 'account_type'); ?>
						<select name="account_type" class="txt-box4" id="account_type">
							
							<option value="Lady traveler" <?php if($account_type=="Lady traveler") echo "selected='selected'";?>>Lady traveler</option>
							<option value="Gents Traveler" <?php if($account_type=="Gents Traveler") echo "selected='selected'";?>>Gents Traveler</option>
							<option value="Couple/Family Traveler" <?php if($account_type=="Couple/Family Traveler") echo "selected='selected'";?>>Couple/Family Traveler</option>
									
						
						</select>			
					</div>
					<div class="field_spacing">
						<?php echo form_label('<span class="required">*</span> Profile status:', 'status'); ?>
						
						<select name="status" class="txt-box4" id="status">
							<option value="1" <?php if($activated=="1") echo "selected='selected'";?>>Enable</option>
							<option value="0" <?php if($activated=="0") echo "selected='selected'";?>>Disable</option>
						</select>			
					</div>
				</div>
			</div>-->
		</div>
        <div class="clear"></div>
		<?php echo form_close(); ?>
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function() {
        $( ".tabs" ).tabs();
    });
</script>
<script type="text/javascript">

function openKCFinder(field, thumb) {
    window.KCFinder = {
        callBack: function(url) {
            window.KCFinder = null;
            
            var img = new Image();
            img.src = url;
            img.onload = function() {
				$('#' + thumb).attr('src',url);
				
				var fileName = url.split('/').pop().split('\\').pop();
				//alert (fileName);
				$('#' + field).attr('value',fileName);
				
            }
        }
    };
    window.open('<?php echo base_url();?>assets/admin/js/kcfinder/browse.php?type=images&dir=images/attorney',
        'kcfinder_image', 'status=0, toolbar=0, location=0, menubar=0, ' +
        'directories=0, resizable=1, scrollbars=0, width=800, height=600'
    );
}

</script>
<script type="text/javascript"><!--
var image_row = <?php echo $image_row ; ?>

function addImage() {
    html  = '<tbody id="image-row' + image_row + '">';
	html += '  <tr>';
	html += '    <td class="left"><div class="image"><img src="<?php echo base_url(); ?>assets/uploads/.thumbs/images/alan/<?=DEFAULT_IMG?>" alt="" id="thumb' + image_row + '" style="height:100px;width:100px;"/><input type="hidden" name="additional_photo[' + image_row + ']" value="" id="additional_photo' + image_row + '" /><br /><a onclick="openKCFinder(\'additional_photo' + image_row + '\', \'thumb' + image_row + '\');">Browse</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$(\'#thumb' + image_row + '\').attr(\'src\', \'\'); $(\'#image' + image_row + '\').attr(\'value\', \'\');">Clear</a></div></td>';
	
	html += '    <td class="left"><a onclick="$(\'#image-row' + image_row  + '\').remove();" class="button">Remove</a></td>';
	html += '  </tr>';
	html += '</tbody>';
	
	$('#images tfoot').before(html);
	
	image_row++;
}
$('select[name=\'country_id\']').bind('change', function() {
	$("#country").val($("#country_id option:selected").attr("countryname"));
	//alert($(this).attr('countryname'));
	$.ajax({
		url: '<?php echo base_url('ajax/state').'/';?>' + this.value,
		dataType: 'json',
		beforeSend: function() {
			$('select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
		},		
		complete: function() {
			$('.wait').remove();
		},			
		success: function(json) {
			html = '<option value="">Select State</option>';
			
			if (json['zone'] != '') {
				for (i = 0; i < json['zone'].length; i++) {
        			html += '<option value="' + json['zone'][i]['zone_id'] + '"';
	    			html += "statename='" + json['zone'][i]['name'] + "'";
					if (json['zone'][i]['zone_id'] == '<?php echo $state_id; ?>') {
	      				html += ' selected="selected"';
	    			}
	
	    			html += '>' + json['zone'][i]['name'] + '</option>';
				}
			} else {
				html += '<option value="0" selected="selected">None</option>';
			}
			
			$('select[name=\'state_id\']').html(html);
			$('select[name=\'state_id\']').trigger('change');
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});

$('select[name=\'country_id\']').trigger('change');
$('select[name=\'state_id\']').bind('change', function() {
	$("#state").val($("#state_id option:selected").attr("statename"));
});
//--></script> 

